// Package sys
// @Link  https://github.com/bufanyun/hotgo
// @Copyright  Copyright (c) 2025 HotGo CLI
// @Author  Ms <133814250@qq.com>
// @License  https://github.com/bufanyun/hotgo/blob/master/LICENSE
// @AutoGenerate Version 2.15.11
package sys

import (
	"context"
	"hotgo/api/admin/orderverifylog"
	"hotgo/internal/model/input/sysin"
	"hotgo/internal/service"
)

var (
	OrderVerifyLog = cOrderVerifyLog{}
)

type cOrderVerifyLog struct{}

// List 查看订单核销记录列表
func (c *cOrderVerifyLog) List(ctx context.Context, req *orderverifylog.ListReq) (res *orderverifylog.ListRes, err error) {
	list, totalCount, err := service.SysOrderVerifyLog().List(ctx, &req.OrderVerifyLogListInp)
	if err != nil {
		return
	}

	if list == nil {
		list = []*sysin.OrderVerifyLogListModel{}
	}

	res = new(orderverifylog.ListRes)
	res.List = list
	res.PageRes.Pack(req, totalCount)
	return
}

// Export 导出订单核销记录列表
func (c *cOrderVerifyLog) Export(ctx context.Context, req *orderverifylog.ExportReq) (res *orderverifylog.ExportRes, err error) {
	err = service.SysOrderVerifyLog().Export(ctx, &req.OrderVerifyLogListInp)
	return
}

// Edit 更新订单核销记录
func (c *cOrderVerifyLog) Edit(ctx context.Context, req *orderverifylog.EditReq) (res *orderverifylog.EditRes, err error) {
	err = service.SysOrderVerifyLog().Edit(ctx, &req.OrderVerifyLogEditInp)
	return
}

// View 获取指定订单核销记录信息
func (c *cOrderVerifyLog) View(ctx context.Context, req *orderverifylog.ViewReq) (res *orderverifylog.ViewRes, err error) {
	data, err := service.SysOrderVerifyLog().View(ctx, &req.OrderVerifyLogViewInp)
	if err != nil {
		return
	}

	res = new(orderverifylog.ViewRes)
	res.OrderVerifyLogViewModel = data
	return
}

// Delete 删除订单核销记录
func (c *cOrderVerifyLog) Delete(ctx context.Context, req *orderverifylog.DeleteReq) (res *orderverifylog.DeleteRes, err error) {
	err = service.SysOrderVerifyLog().Delete(ctx, &req.OrderVerifyLogDeleteInp)
	return
}